package cn.edu.zust.zql.service;

import cn.edu.zust.zql.dao.Dao;
import cn.edu.zust.zql.model.AccUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2016/12/19.
 */
@Service
public class AccUserServiceImpl implements AccUserService{


    @Resource
    private Dao dao;

    public AccUser getAccUserByID(String userid) {
        return (AccUser) dao.findForObject("AccUserMapper.GetAccUserByID", userid);
    }

    public AccUser validateUser(AccUser accUser){
        accUser = (AccUser) dao.findForObject("AccUserMapper.validateUser", accUser);
        if(accUser!=null)
            return getAccUserByID(accUser.getUserid());
        else
            return null;
    }

    public List<AccUser> getAllUser(){
        return dao.findForList("AccUserMapper.getAll", null);
    }

}
